package cn.ac.sec.oil.data_analysis.protocol;

public class ProtocolAnalysisTest {

	public static void main(String[] args) {
		
		ProtocolAnalysis pAnalysis = new ProtocolAnalysis();
		FileOperate fileOperate = new FileOperate();

		/*//构建2组12个模拟包:新数据
		String packet[] = new String[]{fileOperate.FileToStr("E://data/data2/packet1.txt", "gbk"), fileOperate.FileToStr("E://data/data2/packet2.txt", "gbk"), 
				fileOperate.FileToStr("E://data/data2/packet3.txt", "gbk"), fileOperate.FileToStr("E://data/data2/packet4.txt", "gbk"), 
				fileOperate.FileToStr("E://data/data2/packet5.txt", "gbk"), fileOperate.FileToStr("E://data/data2/packet6.txt", "gbk"), 
				fileOperate.FileToStr("E://data/data2/packet1.txt", "gbk"), fileOperate.FileToStr("E://data/data2/packet2.txt", "gbk"), 
				fileOperate.FileToStr("E://data/data2/packet3.txt", "gbk"), fileOperate.FileToStr("E://data/data2/packet4.txt", "gbk"), 
				fileOperate.FileToStr("E://data/data2/packet5.txt", "gbk"), fileOperate.FileToStr("E://data/data2/packet6.txt", "gbk")};*/
		
		//使用一次实际测量数据测试，共13包
		String packet[] = new String[]{fileOperate.FileToStr("E://config/new_data1/data1.txt", "gbk"), fileOperate.FileToStr("E://config/new_data1/data2.txt", "gbk"), 
				fileOperate.FileToStr("E://config/new_data1/data3.txt", "gbk"), fileOperate.FileToStr("E://config/new_data1/data4.txt", "gbk"),
				fileOperate.FileToStr("E://config/new_data1/data5.txt", "gbk"), fileOperate.FileToStr("E://config/new_data1/data6.txt", "gbk"),
				fileOperate.FileToStr("E://config/new_data1/data7.txt", "gbk"), fileOperate.FileToStr("E://config/new_data1/data8.txt", "gbk"),
				fileOperate.FileToStr("E://config/new_data1/data9.txt", "gbk"), fileOperate.FileToStr("E://config/new_data1/data10.txt", "gbk"),
				fileOperate.FileToStr("E://config/new_data1/data11.txt", "gbk"), fileOperate.FileToStr("E://config/new_data1/data12.txt", "gbk"),
				fileOperate.FileToStr("E://config/new_data1/data13.txt", "gbk")};
				
		//多组包的测试
		for (int i = 0; i < packet.length; i++) { 
			
			String[] result = pAnalysis.dataAnalysis("/127.0.0.1:13380;" + packet[i]).split("[:]");
			if (result[0].equals("result")) {
				System.out.println("本次测量数据处理结果： " + result[1]);
			}
		}
	}
}
